Skip to content

Add ALL Methods for Users Endpoints#268

Merged
krowvin merged 29 commits into
mainfrom
266-add-create-method-for-user-management
Mar 11, 2026
Merged

Add ALL Methods for Users Endpoints#268
krowvin merged 29 commits into
mainfrom
266-add-create-method-for-user-management

Conversation

@krowvin

@krowvin krowvin commented Mar 6, 2026

Copy link
Copy Markdown
Collaborator

Created store and update methods and their tests.

Will need #267 in order for all tests to show green/complete

@krowvin krowvin linked an issue Mar 6, 2026 that may be closed by this pull request
Comment thread cwms/users/users.py
Comment thread tests/mock/users/users_test.py Outdated
Comment thread tests/cda/users/users_CDA_test.py Outdated
Comment thread tests/cda/users/users_CDA_test.py Outdated
krowvin added 5 commits March 6, 2026 16:25
- q0hectest key works for normal data, but user-management
     endpoints require CWMS User Admins; l2hectest is a better
     default for these tests
Comment thread tests/cda/conftest.py Fixed
Comment thread tests/cda/conftest.py Fixed
@krowvin

krowvin commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator Author

Requires

For the integration tests to complete, they are hanging on the locations and to ensure latest or a version with the users endpoint is being pulled

@krowvin

krowvin commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator Author

@Enovotny

Tests all clear for the users endpoint (Pending that one commit below)

Two points:

  1. Change from latest-dev to latest #269 - resolves the broken location test and also changes to latest to ensure these endpoints exist
  2. The CodeQL test failed, there's a print statement with an API key in it, Remove FULL API KEY from DEBUG #259 mentions this and
    aaad478

resolves the full key being seen

@krowvin krowvin requested a review from Enovotny March 9, 2026 15:44
@krowvin krowvin changed the title Add Create / Update Methods for Users Add ALL Methods for Users Endpoints Mar 9, 2026
@Enovotny

Enovotny commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator

@Enovotny

Tests all clear for the users endpoint (Pending that one commit below)

Two points:

  1. Change from latest-dev to latest #269 - resolves the broken location test and also changes to latest to ensure these endpoints exist
  2. The CodeQL test failed, there's a print statement with an API key in it, Remove FULL API KEY from DEBUG #259 mentions this and
    aaad478

resolves the full key being seen

what about this fail?

FAILED tests/cda/users/users_CDA_test.py::test_get_user_403_has_friendly_message_for_missing_roles - Failed: DID NOT RAISE <class 'cwms.api.PermissionError'>

@Enovotny

Enovotny commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator
  1. @krowvin merge the Change from latest-dev to latest #269 into main. the rebase this branch with that change.
  2. remove the api Key in the print statement
  3. make sure all tests pass.

@krowvin krowvin requested review from Enovotny and removed request for Enovotny March 11, 2026 16:17
@krowvin

krowvin commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator Author

Resolved

FAILED tests/cda/users/users_CDA_test.py::test_get_user_403_has_friendly_message_for_missing_roles - Failed: DID NOT RAISE <class 'cwms.api.PermissionError'>

@sonarqubecloud

Copy link
Copy Markdown

@krowvin krowvin merged commit 2ec3c00 into main Mar 11, 2026
9 checks passed
@krowvin krowvin deleted the 266-add-create-method-for-user-management branch March 11, 2026 17:27
Enovotny pushed a commit to HydrologicEngineeringCenter/cwms-cli that referenced this pull request Apr 2, 2026
~Draft until~

- HydrologicEngineeringCenter/cwms-python#268

~is~ merged. 

This adds the docs and methods for managing user roles (add/delete)

`cwms-cli users roles`
```bash
Lists the current available roles
```



`cwms-cli users roles -h`
```bash
Commands:
  add     Add one or more roles to an existing user
  delete  Remove one or more roles from an existing user
```

```bash
Usage: cwms-cli users roles add [OPTIONS]
Version: 0.3.2

  Add one or more roles to an existing user

Options:
  --user-name TEXT  Existing user name.
  --roles TEXT      Role name(s) to add. Repeat the option or pass a comma-
                    separated list.
  -h, --help        Show this message and exit.
```

```
```bash
Usage: cwms-cli users roles delete [OPTIONS]
Version: 0.3.2

  Add one or more roles to an existing user

Options:
  --user-name TEXT  Existing user name.
--roles TEXT Role name(s) to add. Repeat the option or pass a comma-
                    separated list.
  -h, --help        Show this message and exit.
```

---------

Co-authored-by: Eric Novotny <nov00002@umn.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Create Method for User Management

3 participants